/*
 * @Author: ReinerLau lk850593913@gmail.com
 * @Date: 2023-01-03 13:40:51
 * @LastEditors: ReinerLau lk850593913@gmail.com
 * @LastEditTime: 2023-01-10 13:12:30
 * @FilePath: \v2.0.0\cypress\support\commands.js
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
Cypress.Commands.add("login", (username, password) => {
  cy.session(username, () => {
    cy.visit("/login");
    cy.get("input[name='username']").type(username);
    cy.get("input[name='password']").type(password);
    cy.get("#login-button").click();
    cy.contains("首页");
  });
});

Cypress.Commands.add("getByData", (selector) => {
  return cy.get(`[data-test=${selector}]`);
});
